#include "StdAfx.h"
#include "VNavItemTables.h"

#include "../VSettings/vsettings.h"

// VNavItemViewTables /////////////////////////////////////////////////////////

//
VNavItemViewTables::VNavItemViewTables(QWidget *parent)
	:VNavItemView(parent)
	,m_itemModel(NULL)
{
}

//
void VNavItemViewTables::setItemModel(VNavItemModel *itemModel)	
{
	m_itemModel = itemModel;
}

//
void VNavItemViewTables::setItem(VNavItem *item,const QModelIndex &index) 
{
}

// VNavItemTables /////////////////////////////////////////////////////////////

//
VNavItemTables::VNavItemTables()
{
}

//
QList<VNavItem*> VNavItemTables::fetchMore()
{
	QSqlQuery qry = VSqlRegTables::selectTablesAsQuery();
	qry.exec(); 
	
	QList<VNavItem*> list;
	
	while (qry.next()) {
		QString tableName = qry.record().value(VSqlRegTables::fTableName()).toString();

		VNavItemTableRecords *item = new VNavItemTableRecords;
			item->setTableName(tableName);
		list << item;
	}

	return list;
}
